package com.example.cart.entity;

import androidx.room.ColumnInfo;
import androidx.room.Entity;
import androidx.room.Ignore;
import androidx.room.PrimaryKey;

import com.example.cart.R;

import java.util.Arrays;
import java.util.List;

import lombok.Data;
import lombok.ToString;

/**
 * 商品信息
 */
@Data
@ToString
@Entity(tableName = "product")
public class Product {

    /**
     * ID主键
     */
    @PrimaryKey(autoGenerate = true )
    private Integer id;

    /**
     * 产品名称
     */
    private String name;

    /**
     * 产品描述
     */
    private String desc;

    /**
     * 价格
     */
    private Double price;

    /**
     * 图片路径
     */
    @ColumnInfo(name = "pic_path")
    private String picPath;

    /**
     * 图片资源编号
     */
    @Ignore
    private int pic;

    public Product() {

    }

    /**
     * 获取初始的商品信息
     * @return 初始的商品列表
     */
    public static List<Product> getInitialProductList() {
        return Arrays.asList(
                build("vivo X200 Pro", 5032.51, "vivo_x200pro", R.drawable.vivo_x200pro, "vivo X200 Pro mini 16GB+512GB 微粉 国家补贴 6.31英寸纤薄小直屏 蔡司"),
                build("vivo iQOO Neo10", 2247.01, "iqoo_neo10", R.drawable.iqoo_neo10, "vivo iQOO Neo10 现货销售【国家补贴】12GB+256GB 驰光白 第三代骁龙8"),
                build("荣耀X60", 1109.0, "honor_x60", R.drawable.honor_x60, "荣耀X60 十面抗摔防水耐磨 5800mAh大电池 一亿像素 AI影像 8+128"),
                build("OPPO Reno13", 3340.51, "oppo_reno13pro", R.drawable.oppo_reno13pro, "OPPO Reno13 12GB+256GB 心动白 超美小直屏 AI高清实况照片 IP69满级"),
                build("荣耀Magic6", 3481.51, "honor_magic6", R.drawable.honor_magic6, "荣耀Magic6 单反级荣耀鹰眼相机 荣耀巨犀玻璃 第三代骁龙8 16+512 绒黑"),
                build("小米 Redmi Note13Pro", 755.01, "readme_note12", R.drawable.readme_note12, "小米 Redmi Note13Pro 国家补贴 骁龙7S 新2亿像素 第二代1.5K高光屏"),
                build("OPPO Find N5", 9999.0, "oppo_find_n5", R.drawable.oppo_find_n5, "OPPO Find N5 16GB+512GB 缎黑 超薄机身 超长续航冰川电池 骁龙8至尊版"),
                build("小米15Ultra", 6999.0, "xiaomi_15_ultra", R.drawable.xiaomi_15_ultra, "小米（MI）小米15Ultra&SU7Ultra齐发布 徕卡2亿超级长焦 白色 16+512 小"),
                build("HUAWEI Pura 70", 4999.0, "huawei_pura_70", R.drawable.huawei_pura_70, "HUAWEI Pura 70 国家补贴500元 12GB+512GB 羽砂黑 北斗卫星消息版"),
                build("苹果iphone16", 3481.51, "apple_iphone16", R.drawable.apple_iphone16, "Apple/苹果 iPhone 16 Pro Max（A3297）1TB 白色钛金属 支持移动联通"),
                build("戴尔（DELL）Optiplex 7010SFF", 4277.51, "dell_optiplex_7020mff", R.drawable.dell_optiplex_7020mff, "戴尔（DELL）Optiplex 7010SFF商用办公台式机电脑(i5-12500 32G 512G固态+1T RX550-4G独显 定制)+23.8英寸")
        );
    }

    public static Product build(String name, Double price, String picPath, int pic, String desc) {
        Product product = new Product();
        product.setName(name);
        product.setDesc(desc);
        product.setPrice(price);
        product.setPicPath(picPath);
        product.setPic(pic);
        return product;
    }
}
